home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / CMCD1104.ISO / Software / Freeware / Grafica / galeroo / Setup Galleroo 3.4.exe / {app} / styles / Tavla / gallery.xsl
Extensible Markup Language  |  2004-05-27  |  14KB  |  335 lines

  1. <?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  3.                 xmlns:exsl="http://exslt.org/common" 
  4.                 xmlns:func="http://exslt.org/functions"
  5.                 xmlns:dyn="http://exslt.org/dynamic"
  6.                 xmlns:math="http://exslt.org/math"
  7.                 xmlns:str="http://exslt.org/strings"
  8.                 xmlns:g="."
  9.                 xmlns:galleroo="."
  10.                 extension-element-prefixes="dyn func exsl math str g galleroo" 
  11.                 version='1.1'>
  12. <xsl:include href="../Lib/galleroo.xsl" />
  13.  
  14. <xsl:output method="html" /> 
  15.  
  16. <!-- doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" indent="yes" -->
  17.  
  18. <!-- Galleroo Tavla XSL XML->HTML stylesheet 1.2
  19.      Copyright 2003-2004, all rights reserved, xyster.net
  20.      written:     5/7/03
  21.      modified:  2/11/03
  22.      author:     xyster
  23.  
  24.      comments:     
  25. -->
  26.  
  27. <xsl:param name="rows-per-index">3</xsl:param>
  28. <xsl:param name="columns-per-index">4</xsl:param>
  29. <xsl:param name="title">Photo Gallery</xsl:param>
  30. <xsl:param name="sub-title" />
  31. <xsl:param name="text-color">#000000</xsl:param>
  32. <xsl:param name="background-color">#FFFFFF</xsl:param>
  33. <xsl:param name="link-color">#0000FF</xsl:param>
  34. <xsl:param name="visited-link-color">#800080</xsl:param>
  35. <xsl:param name="active-link-color">#FF0000</xsl:param>
  36. <xsl:param name="previous-image">previous.gif</xsl:param>
  37. <xsl:param name="next-image">next.gif</xsl:param>
  38. <xsl:param name="home-image">home.gif</xsl:param>
  39. <xsl:param name="blank-image">blank.gif</xsl:param>
  40. <xsl:param name="sort-by">date</xsl:param>
  41. <xsl:param name="thumb-size">75</xsl:param>
  42. <xsl:param name="do-three-stage">no</xsl:param>
  43. <xsl:param name="html-file-prefix" />
  44. <xsl:param name="do-auto-play-movies">no</xsl:param>
  45. <xsl:param name="background-image" />
  46. <xsl:param name="do-thumb-slider">no</xsl:param>
  47. <xsl:param name="custom-css-file" />
  48. <xsl:param name="font" />
  49.  
  50. <xsl:variable name="thumbs-per-index" select="$rows-per-index * $columns-per-index" />
  51.  
  52. <xsl:template match="list">
  53.  
  54.     <!-- yummy! copy over the pix to a new *sorted* list
  55.     -->
  56.     <xsl:variable name="sorted-pix" select="galleroo:sort-pix(media/object/children/object/children/object, $sort-by)" />
  57.  
  58.     <!-- css -->
  59.     <xsl:call-template name="gal-emit-css-file">
  60.         <xsl:with-param name="name" select="'index'" />
  61.         <xsl:with-param name="html-file-prefix" select="$html-file-prefix" />
  62.         <xsl:with-param name="background-image" select="$background-image" />
  63.         <xsl:with-param name="background-color" select="$background-color" />
  64.         <xsl:with-param name="font" select="$font" />
  65.         <xsl:with-param name="text-color" select="$text-color" />
  66.         <xsl:with-param name="link-color" select="$link-color" />
  67.         <xsl:with-param name="active-link-color" select="$active-link-color" />
  68.         <xsl:with-param name="visited-link-color" select="$visited-link-color" />
  69.     </xsl:call-template>
  70.     
  71.     <!-- gallery -->
  72.     <xsl:for-each select="exsl:node-set($sorted-pix)/*[position() mod $thumbs-per-index = 1]">
  73.         <xsl:call-template name="index">
  74.             <xsl:with-param name="pix" select="following-sibling::object[position() < $thumbs-per-index] | self::object" />
  75.             <xsl:with-param name="index-index" select="position()" />
  76.             <xsl:with-param name="index-last" select="last()" />
  77.         </xsl:call-template>
  78.     </xsl:for-each>
  79.  
  80. </xsl:template>
  81.  
  82. <xsl:template name="index">
  83.     <xsl:param name="pix" />
  84.     <xsl:param name="index-index" />
  85.     <xsl:param name="index-last" />
  86.     <html>
  87.         <xsl:comment> Transformed from XML with Galleroo Tavla XSL stylesheet 1.2 </xsl:comment>
  88.         <xsl:comment> Source path='<xsl:value-of select="$source-root/list/media/basepath" />' </xsl:comment>
  89.     <head>
  90.     <link type="text/css" rel="stylesheet" href="{$html-file-prefix}index.css" />
  91.     <xsl:if test="string-length($custom-css-file) != 0">
  92.         <link type="text/css" rel="stylesheet" href="{$custom-css-file}" />
  93.     </xsl:if>    
  94.  
  95.     <title><xsl:value-of select="$title" /> - <xsl:value-of select="$sub-title" /> (page <xsl:value-of select="$index-index" /> of <xsl:value-of select="$index-last" />)</title>
  96.     </head>
  97.     <body class="index-page">
  98.  
  99.     <!-- title -->
  100.     <div align="center"><h1><xsl:value-of select="$title" /></h1></div>
  101.     
  102.     <!-- subtitle -->
  103.     <div align="center"><h3><xsl:value-of select="$sub-title" /></h3></div> 
  104.         
  105.     <!-- navigation bar -->
  106.     <div>
  107.     <table align="center" border="0">
  108.     <tr>
  109.         <!-- previous -->
  110.         <td>
  111.         <xsl:choose>
  112.             <xsl:when test="$index-index = 1">
  113.                 <img src="{$blank-image}" border="0" />
  114.             </xsl:when>
  115.             <xsl:otherwise>
  116.                 <a href="{$html-file-prefix}{galleroo:index-html-name($index-index - 1)}"><img src="{$previous-image}" border="0" /></a>
  117.             </xsl:otherwise>
  118.         </xsl:choose>    
  119.        </td>
  120.        <!-- home -->
  121.        <td>
  122.        <a href="../index.html"><img src="{$home-image}" border="0" /></a>
  123.        </td>
  124.        <!-- next -->
  125.        <td>
  126.          <xsl:choose>
  127.             <xsl:when test="$index-index = $index-last">
  128.                 <img src="{$blank-image}" border="0" />
  129.             </xsl:when>
  130.             <xsl:otherwise>
  131.                 <a href="{$html-file-prefix}{galleroo:index-html-name($index-index + 1)}"><img src="{$next-image}" border="0" /></a>
  132.             </xsl:otherwise>
  133.          </xsl:choose>
  134.        </td>
  135.     </tr>
  136.     <!-- page index -->
  137.     <tr>
  138.     <td align="center" colspan="3">
  139.      page <xsl:value-of select="$index-index" /> of <xsl:value-of select="$index-last" />
  140.     </td>
  141.     </tr>
  142.     </table>
  143.     </div>
  144.     
  145.     <!-- thumbnail table -->
  146.     <div>
  147.     <xsl:call-template name="table">
  148.         <xsl:with-param name="pix" select="$pix[position() <= $thumbs-per-index]" />
  149.     </xsl:call-template>
  150.     </div>
  151.       
  152.       <!-- lister signature -->
  153.     <xsl:call-template name="gal-emit-signature" />
  154.       
  155.       </body>
  156.     </html>
  157.     
  158.     <!-- cutter output -->
  159.     <xsl:call-template name="gal-emit-cutter-index">
  160.         <xsl:with-param name="index" select="$index-index" />
  161.         <xsl:with-param name="html-file-prefix" select="$html-file-prefix" />
  162.     </xsl:call-template>
  163.   
  164.     <!-- generate the picture pages -->
  165.     <xsl:call-template name="pages">
  166.         <xsl:with-param name="pix" select="$pix" />
  167.         <xsl:with-param name="parent-index" select="$index-index" />
  168.         <xsl:with-param name="index-last" select="$index-last" />
  169.     </xsl:call-template>
  170.     
  171. </xsl:template>
  172.  
  173. <xsl:template name="table">
  174.     <xsl:param name="pix" />
  175.     <table class="thumb-table" align="center" cellspacing="10" cellpadding="0" border="0">
  176.         <!-- jump $columns-per-index objects each time and splat
  177.              out the table columns
  178.         -->     
  179.         <xsl:for-each select="$pix[position() mod $columns-per-index = 1]">
  180.             <tr>
  181.             <xsl:call-template name="table-columns-thumbs">
  182.                 <xsl:with-param name="pix" select="following-sibling::object[position() < $columns-per-index] | self::object" />
  183.             </xsl:call-template>
  184.             </tr>
  185.             <tr>
  186.             <xsl:call-template name="table-columns-names">
  187.                 <xsl:with-param name="pix" select="following-sibling::object[position() < $columns-per-index] | self::object" />
  188.             </xsl:call-template>
  189.             </tr>
  190.         </xsl:for-each>    
  191.     </table>
  192. </xsl:template>
  193.  
  194. <xsl:template name="table-columns-thumbs">
  195.     <xsl:param name="pix" />
  196.     
  197.     <!-- our job is easy down here. Simply go over all the 
  198.          objects given us and splat them out in their cells
  199.     -->     
  200.     <xsl:for-each select="$pix">
  201.         <td align="center" width="{attrib/thumb-x-size}">
  202.         <a href="{$html-file-prefix}{attrib/name}.html"><img class="thumb" width="{attrib/thumb-x-size}" height="{attrib/thumb-y-size}" src="{attrib/thumb-path}/{attrib/thumb-name}" border="0" /></a>
  203.         </td>
  204.     </xsl:for-each>
  205. </xsl:template>
  206.  
  207. <xsl:template name="table-columns-names">
  208.     <xsl:param name="pix" />
  209.     
  210.     <!-- our job is easy down here. Simply go over all the 
  211.          objects given us and splat them out in their cells
  212.     -->     
  213.     <xsl:for-each select="$pix">
  214.         <td align="center" valign="top" width="{attrib/thumb-x-size}">
  215.         <a href="{$html-file-prefix}{attrib/name}.html">
  216.         <xsl:value-of select="galleroo:image-title(attrib)" />
  217.         <xsl:value-of select="galleroo:image-caption(attrib)" />
  218.         </a>
  219.         </td>
  220.     </xsl:for-each>
  221. </xsl:template>
  222.  
  223. <xsl:template name="pages">
  224.     <xsl:param name="pix" />
  225.     <xsl:param name="parent-index" />
  226.     <xsl:param name="index-last" />
  227.         
  228.     <xsl:for-each select="$pix">
  229.         <html>
  230.             <xsl:comment> Transformed from XML with Galleroo Index XSL stylesheet 1.0 </xsl:comment>
  231.             <xsl:comment> Source path='<xsl:value-of select="$source-root/list/media/basepath" />' </xsl:comment>
  232.         <head>
  233.             <title><xsl:value-of select="galleroo:image-title(attrib)" /><xsl:value-of select="galleroo:image-caption(attrib)" /></title>
  234.             <link type="text/css" rel="stylesheet" href="{$html-file-prefix}index.css" />
  235.             <xsl:if test="string-length($custom-css-file) != 0">
  236.                 <link type="text/css" rel="stylesheet" href="{$custom-css-file}" />
  237.             </xsl:if>    
  238.         </head>
  239.         <body class="slide-page">
  240.  
  241.             <!-- title -->
  242.             <div align="center"><h1><xsl:value-of select="$title" /></h1></div>
  243.             
  244.             <!-- navigation bar -->
  245.             <div align="center">      
  246.                 <table align="center" border="0">
  247.                 <tr>
  248.                     <td> </td>    
  249.  
  250.                     <!-- previous -->
  251.                     <td align="right">
  252.                         <xsl:choose>
  253.                             <xsl:when test="position() = 1 and $parent-index = 1">
  254.                                 <img src="{$blank-image}" border="0" />
  255.                             </xsl:when>
  256.                             <xsl:otherwise>
  257.                                 <a href="{$html-file-prefix}{galleroo:previous-image()/attrib/name}.html"><img src="{$previous-image}" border="0" /></a>
  258.                             </xsl:otherwise>
  259.                         </xsl:choose>    
  260.                     </td>
  261.                     <!-- home -->
  262.                     <td align="center">
  263.                         <a href="{$html-file-prefix}{galleroo:index-html-name($parent-index)}"><img src="{$home-image}" border="0" /></a>
  264.                     </td>
  265.                    
  266.                     <!-- next -->
  267.                     <td align="left">
  268.                         <xsl:choose>    
  269.                             <xsl:when test="position() = last() and $parent-index = $index-last">
  270.                                 <img src="{$blank-image}" border="0" />
  271.                             </xsl:when>
  272.                             <xsl:otherwise>
  273.                                    <a href="{$html-file-prefix}{galleroo:next-image()/attrib/name}.html"><img src="{$next-image}" border="0" /></a>
  274.                             </xsl:otherwise>
  275.                         </xsl:choose>
  276.                     </td>    
  277.  
  278.                     <td> </td>
  279.  
  280.                 </tr>
  281.                 
  282.                 <!-- thumbnail slider -->
  283.                 <xsl:if test="$do-thumb-slider = 'yes'">
  284.                     <xsl:call-template name="gal-emit-horizontal-thumb-slider">
  285.                         <xsl:with-param name="html-file-prefix" select="$html-file-prefix" />
  286.                         <xsl:with-param name="thumb-size" select="$thumb-size" />
  287.                         <xsl:with-param name="parent-index" select="$parent-index" />
  288.                         <xsl:with-param name="index-last" select="$index-last" />
  289.                     </xsl:call-template>
  290.                 </xsl:if>
  291.  
  292.                 </table>
  293.             </div>
  294.  
  295.             <!-- subtitle -->
  296.             <div align="center">
  297.             <h3><xsl:value-of select="galleroo:image-title(attrib)" /></h3>
  298.             </div>
  299.             
  300.             <!-- comment -->
  301.             <div style="text-align:center; margin-left:auto; margin-right:auto; align:center; width:50%; padding:1em;">
  302.             <xsl:value-of select="galleroo:image-comment(attrib)" />
  303.             </div>
  304.             
  305.             <!-- image -->
  306.             <xsl:call-template name="gal-emit-image">
  307.                 <xsl:with-param name="do-auto-play-movies" select="$do-auto-play-movies" />
  308.             </xsl:call-template>
  309.                  
  310.             <!-- download original -->    
  311.             <xsl:if test="boolean(attrib/original-path)">
  312.                 <div align="center">
  313.                 <a href="{attrib/original-path}/{attrib/name}">Download Original (<xsl:number value="attrib/file-size" /> Bytes)</a>
  314.                 
  315.                 <!-- commented out pretty number output until xsltproc is fixed.
  316.                     <a href="{attrib/original-path}/{attrib/name}">Download Original (<xsl:number value="attrib/file-size div 1024" grouping-separator="," grouping-size="3" />KB)</a>
  317.                 -->    
  318.                 </div>
  319.             </xsl:if>
  320.  
  321.             <!-- lister signature -->
  322.               <xsl:call-template name="gal-emit-signature" />
  323.         </body>
  324.         </html>
  325.  
  326.         <!-- cutter output -->
  327.         <xsl:call-template name="gal-emit-cutter-slide">
  328.             <xsl:with-param name="html-file-prefix" select="$html-file-prefix" />
  329.         </xsl:call-template>
  330.          
  331.     </xsl:for-each>    
  332. </xsl:template>
  333.  
  334. </xsl:stylesheet>
  335.